package func

/**
 * 匿名函数
 *
 * @author tzp
 * @since 2021/1/15
 */
object AnoFunc {
  def main(args: Array[String]): Unit = {
    val someNums = List(1, 2, 3)

    val p: Int => Boolean = (x: Int) => x > 2
    println(someNums.filter(p).mkString)

    println(someNums.filter((x: Int) => x > 2).mkString)
    println(someNums.filter((x) => x > 2).mkString)
    println(someNums.filter(x => x > 2).mkString)
    println(someNums.filter(_ > 2).mkString)

    val add1 = (a: Int) => a + 1
    val x  = add1.andThen(add1)
    println(x(10))


  }

}
